package atag.gui;
/*
 * TrackDeployStatus.java
 *
 * Created on August 1, 2007, 6:38 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author Fogsus
 */
import javax.swing.*; 		// For JPanel, etc.
import InterMessages.*;

public class TrackDeployStatus implements Runnable{
    
    int delay;
    JTextArea displayScreen;
    SunspotsDeployStatus m_sunspotsDeployStatus;
    /** Creates a new instance of TrackDeployStatus */
    public TrackDeployStatus(SunspotsDeployStatus sunspotsDeployStatus, JTextArea textArea, int delayTime) {
        //m_sunspotsDeployStatus = new SunspotsDeployStatus();
        m_sunspotsDeployStatus = sunspotsDeployStatus;
        delay = delayTime;
        displayScreen = textArea;
    }
    
    
    public void run() {
        int preSize = 0;
        try {
            for(;;) {
                if (this.m_sunspotsDeployStatus.getEntriesNumber() != preSize) {
                //for (int i = 0; i < this.m_sunspotsDeployStatus.deployStatus.size(); i++) {
                    preSize = this.m_sunspotsDeployStatus.getEntriesNumber();
                    this.displayScreen.append(this.m_sunspotsDeployStatus.getLastEntry() + "\n");
                }
                Thread.sleep(delay);
            }
        }
        catch (InterruptedException e) {
            return;
        }
        //displayScreen.append("good!");
    }
    
}
